home *** CD-ROM | disk | FTP | other *** search
Wrap
<refentry id="GimpChainButton" revision="19 Jan 2001"> <refmeta> <refentrytitle>GimpChainButton</refentrytitle> <manvolnum>3</manvolnum> <refmiscinfo>LIBGIMP Library</refmiscinfo> </refmeta> <refnamediv> <refname>GimpChainButton</refname><refpurpose>Widget to visually connect two entry widgets.</refpurpose> </refnamediv> <refsynopsisdiv><title>Synopsis</title> <synopsis> struct <link linkend="GimpChainButton-struct">GimpChainButton</link>; #define <link linkend="GIMP-CHAIN-BUTTON-CAPS">GIMP_CHAIN_BUTTON</link> (obj) enum <link linkend="GimpChainPosition">GimpChainPosition</link>; <link linkend="GtkWidget">GtkWidget</link>* <link linkend="gimp-chain-button-new">gimp_chain_button_new</link> (<link linkend="GimpChainPosition">GimpChainPosition</link> position); void <link linkend="gimp-chain-button-set-active">gimp_chain_button_set_active</link> (<link linkend="GimpChainButton">GimpChainButton</link> *gcb, <link linkend="gboolean">gboolean</link> is_active); <link linkend="gboolean">gboolean</link> <link linkend="gimp-chain-button-get-active">gimp_chain_button_get_active</link> (<link linkend="GimpChainButton">GimpChainButton</link> *gcb); </synopsis> </refsynopsisdiv> <refsect1> <title>Object Hierarchy</title> <synopsis> <link linkend="GtkObject">GtkObject</link> +----<link linkend="GtkWidget">GtkWidget</link> +----<link linkend="GtkContainer">GtkContainer</link> +----<link linkend="GtkTable">GtkTable</link> +----GimpChainButton </synopsis> </refsect1> <refsect1> <title>Signal Prototypes</title> <synopsis> "<link linkend="GimpChainButton-toggled">toggled</link>" void user_function (<link linkend="GimpChainButton">GimpChainButton</link> *gimpchainbutton, <link linkend="gpointer">gpointer</link> user_data); </synopsis> </refsect1> <refsect1> <title>Description</title> <para> This widget provides a button showing either a linked or a broken chain that can be used to link two entries, spinbuttons, colors or other GUI elements and show that they may be locked. Use it for example to connect X and Y ratios to provide the possibility of a constrained aspect ratio. </para> <para> The <link linkend="GimpChainButton">GimpChainButton</link> only gives visual feedback, it does not really connect widgets. You have to take care of locking the values yourself by checking the state of the <link linkend="GimpChainButton">GimpChainButton</link> whenever a value changes in one of the connected widgets and adjusting the other value if necessary. </para> </refsect1> <refsect1> <title>Details</title> <refsect2> <title><anchor id="GimpChainButton-struct">struct GimpChainButton</title> <programlisting>struct GimpChainButton;</programlisting> <para> </para></refsect2> <refsect2> <title><anchor id="GIMP-CHAIN-BUTTON-CAPS">GIMP_CHAIN_BUTTON()</title> <programlisting>#define GIMP_CHAIN_BUTTON(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CHAIN_BUTTON, GimpChainButton)) </programlisting> <para> Checks if the passed pointer is a pointer to a <link linkend="GimpChainButton">GimpChainButton</link> and performs the cast if valid. </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>obj</parameter> :</entry> <entry>The pointer to cast. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="GimpChainPosition">enum GimpChainPosition</title> <programlisting>typedef enum { GIMP_CHAIN_TOP, GIMP_CHAIN_LEFT, GIMP_CHAIN_BOTTOM, GIMP_CHAIN_RIGHT } GimpChainPosition; </programlisting> <para> </para></refsect2> <refsect2> <title><anchor id="gimp-chain-button-new">gimp_chain_button_new ()</title> <programlisting><link linkend="GtkWidget">GtkWidget</link>* gimp_chain_button_new (<link linkend="GimpChainPosition">GimpChainPosition</link> position);</programlisting> <para> Creates a new <link linkend="GimpChainButton">GimpChainButton</link> widget. </para> <para> This returns a button showing either a broken or a linked chain and small clamps attached to both sides that visually group the two widgets you want to connect. This widget looks best when attached to a table taking up two columns (or rows respectively) next to the widgets that it is supposed to connect. It may work for more than two widgets, but the look is optimized for two.</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>position</parameter> :</entry> <entry> The position you are going to use for the button with respect to the widgets you want to chain. </entry></row> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> Pointer to the new <link linkend="GimpChainButton">GimpChainButton</link>, which is inactive by default. Use <link linkend="gimp-chain-button-set-active">gimp_chain_button_set_active</link>() to change its state. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-chain-button-set-active">gimp_chain_button_set_active ()</title> <programlisting>void gimp_chain_button_set_active (<link linkend="GimpChainButton">GimpChainButton</link> *gcb, <link linkend="gboolean">gboolean</link> is_active);</programlisting> <para> Sets the state of the <link linkend="GimpChainButton">GimpChainButton</link> to be either locked (TRUE) or unlocked (FALSE) and changes the showed pixmap to reflect the new state.</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>gcb</parameter> :</entry> <entry> Pointer to a <link linkend="GimpChainButton">GimpChainButton</link>. </entry></row> <row><entry align="right"><parameter>is_active</parameter> :</entry> <entry> The new state. </entry></row> </tbody></tgroup></informaltable></refsect2> <refsect2> <title><anchor id="gimp-chain-button-get-active">gimp_chain_button_get_active ()</title> <programlisting><link linkend="gboolean">gboolean</link> gimp_chain_button_get_active (<link linkend="GimpChainButton">GimpChainButton</link> *gcb);</programlisting> <para> Checks the state of the <link linkend="GimpChainButton">GimpChainButton</link>.</para> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>gcb</parameter> :</entry> <entry> Pointer to a <link linkend="GimpChainButton">GimpChainButton</link>. </entry></row> <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> TRUE if the <link linkend="GimpChainButton">GimpChainButton</link> is active (locked). </entry></row> </tbody></tgroup></informaltable></refsect2> </refsect1> <refsect1> <title>Signals</title> <refsect2><title><anchor id="GimpChainButton-toggled">The "toggled" signal</title> <programlisting>void user_function (<link linkend="GimpChainButton">GimpChainButton</link> *gimpchainbutton, <link linkend="gpointer">gpointer</link> user_data);</programlisting> <para> </para><informaltable pgwide=1 frame="none" role="params"> <tgroup cols="2"> <colspec colwidth="2*"> <colspec colwidth="8*"> <tbody> <row><entry align="right"><parameter>gimpchainbutton</parameter> :</entry> <entry>the object which received the signal. </entry></row> <row><entry align="right"><parameter>user_data</parameter> :</entry> <entry>user data set when the signal handler was connected.</entry></row> </tbody></tgroup></informaltable></refsect2> </refsect1> <refsect1> <title>See Also</title> <para> You may want to use the convenience function <link linkend="gimp-coordinates-new">gimp_coordinates_new</link>() to set up two GimpSizeEntries (see <link linkend="GimpSizeEntry">GimpSizeEntry</link>) linked with a <link linkend="GimpChainButton">GimpChainButton</link>. </para> </refsect1> </refentry>